//k1 edit 2021.12.09

if(isNil("A3E_MortarMarkerNumber")) then {
	A3E_MortarMarkerNumber = 0;
} else {
	A3E_MortarMarkerNumber = A3E_MortarMarkerNumber +1;
};
_number = A3E_MortarMarkerNumber;
_position = [_this,0] call bis_fnc_param;

private["_obj","_pos","_dir","_gunner"];

_pos = _position vectorAdd [-3.44775,0.299561,-0.00143909];
_obj = "Land_HBarrier_Big_F" createVehicle _pos;
_dir = 270;
_obj setdir _dir;
_obj setpos _pos;
_pos = _position vectorAdd [-2.71875,7.29565,-0.00143909];
_obj = "Land_HBarrier_Big_F" createVehicle _pos;
_dir = 0;
_obj setdir _dir;
_obj setpos _pos;
_pos = _position vectorAdd [4.63525,6.12305,-0.00143909];
_obj1 = "Land_HBarrierTower_F" createVehicle _pos;
_dir = 180;
_obj1 setdir _dir;
_obj1 setpos _pos;

_gun = selectRandom (a3e_arr_Escape_SWC_MG_H + a3e_arr_Escape_SWC_GM_H);
_static = createVehicle [_gun, [0,0,0], [], 0, "NONE"];
_static attachTo [_obj1,[-.5,-2,1.7]];
detach _static;
_static setdir (getdir _obj1 -180);
Escape_allStatics pushback _static;
Escape_all_assets pushback _static;
_static setVariable ["Escape_assets_control", true, true];

_pos = _position vectorAdd [5.15039,6.06348,2.02836];
_obj = "Land_SandbagBarricade_01_half_F" createVehicle _pos;
_dir = 180;
_obj setdir _dir;
_obj setpos _pos;
_pos = _position vectorAdd [1.66992,-3.65332,-0.00143909];
_obj = "Land_HBarrier_Big_F" createVehicle _pos;
_dir = 0;
_obj setdir _dir;
_obj setpos _pos;
_pos = _position vectorAdd [6.71729,0.229248,-0.00143909];
_obj = "Land_HBarrier_Big_F" createVehicle _pos;
_dir = 90;
_obj setdir _dir;
_obj setpos _pos;

_pos = _position vectorAdd [-1.3,-1.45,0];
_box = "O_CargoNet_01_ammo_F" createVehicle _pos;
_box allowDamage false;
_box setDir 356;
_box setpos _pos;

_pos = _position vectorAdd [1.53,-0.14,0];
_obj = createVehicle [a3e_arr_MortarSite select(floor(random(count(a3e_arr_MortarSite)))), [0,0,999], [], 0, "NONE"]; //
_obj setDir 0;
_obj setPosATL _pos;
_gunner = [_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner; 
a3e_var_artillery_units pushBack _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];

_pos = _position vectorAdd [4.74,6.62,4.24];
_obj = createVehicle [a3e_arr_MortarSite select(floor(random(count(a3e_arr_MortarSite)))), [0,0,999], [], 0, "NONE"]; //
_obj setDir 1.3;
_obj setPosATL _pos;
_gunner = [_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner; 
a3e_var_artillery_units pushBack _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];

_gun = selectRandom (a3e_arr_Escape_SWC_MG + a3e_arr_Escape_SWC_MG_H + a3e_arr_Escape_SWC_MG_A);
_pos = _position vectorAdd [4.4,-0.822,0.1];
_static = createVehicle [_gun, [0,0,999], [], 0, "NONE"]; //"CAN_COLLIDE"
_static setDir 312;
_static setPosATL _pos;
Escape_allStatics pushback _static;
Escape_all_assets pushback _static;
_static setVariable ["Escape_assets_control", true, true];

Escape_campType_arr pushback [_position,"迫击炮点","k1"];
publicVariable "Escape_campType_arr";

["A3E_MortarSiteMapMarker" + str _number,_position,"o_mortar"] call A3E_fnc_createLocationMarker;

_marker = createMarkerLocal ["A3E_MortarSitePatrolMarker" + str _number, _position];
_marker setMarkerShapeLocal "ELLIPSE";
_marker setMarkerAlpha 0;
_marker setMarkerSizeLocal [50,50];


